package cn.satoken.controller;

import cn.satoken.service.QwenService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <h3>saToken</h3>
 * <p></p>
 *
 * @author gdw
 * @since 2025-06-06 16:48:02
 */
@RestController
@RequestMapping("/ai/")
@RequiredArgsConstructor
public class QwenController {

    private final QwenService qwenService;

    @PostMapping("chat")
    public ResponseEntity<?> chat(@RequestBody Map<String, String> body) {
        String prompt = body.get("message");
        String result = qwenService.chatWithQwen(prompt);
        return ResponseEntity.ok(result);
    }
}
